package com.me.myHungTrung;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL10;

public class GameController {
	static MyHungTrung game;
	public static int windowWidth;
	public static int windowHeight;
	
//	public static boolean isDEBUG = true;/////////Test
	public static boolean isDEBUG = false;/////////Real
	
	public GameController(MyHungTrung _game){
		game = _game;
		windowWidth = Gdx.graphics.getWidth();
		windowHeight = Gdx.graphics.getHeight();
		Gdx.graphics.setDisplayMode(windowWidth, windowHeight, !isDEBUG);//neu isDEBUG thi ko set fullscreen
		
		//Load hinh anh trong game
		Assets.load();
		
		Gdx.input.setCatchBackKey(true);
	}
	
	public void startGame(){
		Gdx.gl.glViewport(0, 0, windowWidth, windowHeight);
		this.setScreen(new GameScreen(this, windowWidth, windowHeight));
//		this.showGameScreen(new GameScreen(gameController, windowWidth, windowHeight, player));		
		
	}
	
	public void setScreen(Screen screen){
		game.setScreen(screen);
	}	
	
	public void update(){
		Gdx.gl.glClearColor(0, 0, 0, 1);
		Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
//		game.getScreen().render(1.0f/45.0f);
		game.getScreen().render(Gdx.graphics.getDeltaTime());
	}
	
	public void ExitGame(){		
		game.dispose();
		Gdx.app.exit();		
	}
}
